<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>注册 - {:configure('website.webName')}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="//cdn.bootcdn.net/ajax/libs/layui/2.5.7/css/layui.css">
  <link rel="stylesheet" href="/static/dist/style/login.css?v=1.6.0 pro-1" media="all">
  <link rel="stylesheet" href="/static/dist/style/admin.css?v=1.6.0 pro-1" media="all">
  <link rel="stylesheet" href="//cdn.bootcdn.net/ajax/libs/layui/2.5.7/css/modules/layer/default/layer.css?v=3.1.1" media="all">
  <script src="//cdn.bootcdn.net/ajax/libs/layui/2.5.7/layui.all.js"></script>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  <style type="text/css">
    .layui-card {border-radius: 5px;}
    .layui-input {border-radius: .25rem;}
    .layui-input, .layui-select, .layui-textarea {
    height: 45px;
    line-height: 45px\9;
	}
    .layadmin-user-login-icon {
    
    width: 45px;
    line-height: 43px;
        }
      .layui-icon {
    
    font-size: 26px;
        }
      .layadmin-user-login-body .layui-form-item .layui-input {
    padding-left: 46px;
        font-size: 16px;
	}
      .layui-btn {font-size: 20px;}
    .layui-input:hover,.layui-textarea:hover{border-color:#5FB878!important}.layui-input:focus,.layui-textarea:focus{border-color:#007bff!important;box-shadow:0 0 0 .2rem rgba(0,123,255,.1);}
   </style>
{:hook('login_index_head_extra')}
</head>

<!--<body style="min-width: 405px;height: auto;overflow: hidden;">-->
<body>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;padding: 5% 0;">
  <div class="layadmin-user-login-main">
    <div class="layadmin-user-login-box layadmin-user-login-header">
      <a class="wds-login" href="/"><img src="/static/wendasns/images/login.png"></a>
      
    </div>
    </div>
    <div class="layui-card layadmin-user-login-main">
    <div class="layui-tab layui-tab-brief">
              <ul class="layui-tab-title">
    			<li class="layui-this"><a href="{:url('/register')}" >邮箱注册</a></li>
    			{:hook('global_register_mobile_extra')}
  			</ul>
            <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
    <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
	<div class="layui-form-item">
        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-nickname"></label>
        <input type="text" name="username" id="LAY-user-login-nickname" lay-verify="required" placeholder="用户名" class="layui-input">
      </div>
	  <div class="layui-form-item">
        <label class="layadmin-user-login-icon layui-icon layui-icon-email" for="LAY-user-login-nickname"></label>
        <input type="text" name="email" id="LAY-user-login-nickname" lay-verify="required|email" placeholder="邮箱" class="layui-input">
      </div>

      <div class="layui-form-item">
        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
        <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
      </div>
      <div class="layui-form-item">
        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-repass"></label>
        <input type="password" name="repassword" id="LAY-user-login-repass" lay-verify="required" placeholder="确认密码" class="layui-input">
      </div>

	{:hook('global_register_item')}

		<div class="layui-form-item">
			<div id="slider"></div>
		</div>
		
      <div class="layui-form-item">
        <input type="checkbox" name="agreement" lay-skin="primary" title="同意用户协议" checked>
      </div>
      <div class="layui-form-item">
        <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-reg-submit">注 册</button>
      </div>
      <div class="layui-trans layui-form-item login-oauth">
      	{if miniapp() neq true}{:hook('global_login_extra')}
        
        <a href="{:url('/login')}" class="layadmin-user-jump-change layadmin-link layui-hide-xs">帐号登录</a>
        <a href="{:url('/login')}" class="layadmin-user-jump-change layadmin-link layui-hide-sm layui-show-xs-inline-block">帐号登录</a>
        {else}
        <a href="{:url('/login')}" class="layadmin-user-jump-change layadmin-link layui-hide-xs">帐号登录</a>
        <a href="{:url('/login')}" class="layadmin-user-jump-change layadmin-link layui-hide-sm layui-show-xs-inline-block">帐号登录</a>
        {/if}
      </div>
    </div>
    </div>
    {:hook('global_register_mobile_tab_item')}
    </div>
   </div>
  </div>
  
  <div class="" style="padding: 20px;text-align: center;color: rgba(0,0,0,.5);">
    <p><a href="/" >返回首页</a> © {:date('Y',time())} <a href="http://www.wendasns.com/" target="_blank">Wendasns</a></p>
  </div>

</div>
<script>
layui.config({
  base: '/static/wendasns/lay/modules/'
  ,version: new Date().getTime()
}).use(['sliderVerify'], function(){
  var $ = layui.$
  ,setter = layui.setter
  ,form = layui.form
  ,sliderVerify = layui.sliderVerify
  ,router = layui.router();

  form.render();
  
	var slider = sliderVerify.render({
		elem: '#slider',
		onOk: function(){
			layer.msg("滑块验证通过");
		}
	});
	
  //提交
  form.on('submit(LAY-user-reg-submit)', function(obj){
    var field = obj.field,_this = $(this);
    
	if(!slider.isOk()){
		return layer.msg("请先通过滑块验证");
	}
	
    //确认密码
    if(field.password !== field.repassword){
      return layer.msg('两次密码输入不一致');
    }
    
    //是否同意用户协议
    if(!field.agreement){
      return layer.msg('你必须同意用户协议才能注册');
    }
    
    //请求接口
    $.ajax({
    	type: 'post'
      ,url: '{:url('ucentre/register/index')}' //实际使用请改成服务端真实接口
      ,data: field
      ,dataType: 'json'
    		,beforeSend: function(XMLHttpRequest){
    			var textnode = document.createTextNode('\u4e2d\u002e\u002e\u002e');
  	  	  		_this[0].appendChild(textnode);
  	  	  		_this.prop('disabled',true).addClass('layui-btn-disabled');
    		}
    		,complete: function(XMLHttpRequest, textStatus){
    			var org_text = _this.text();
  	  	  	  	_this.text(org_text.replace(/(\u4e2d\u002e\u002e\u002e)$/, ''));
  	  	  	  	_this.prop('disabled',false).removeClass('layui-btn-disabled');
  	  	  	}
      ,success: function(res){
      
                if(res.code==0){
                	layer.msg(res.msg,{time:1000},function(){
                		location.href = '/';
                	});
                }else{
                	layer.msg(res.msg);
                }
                
      }
    		,error: function(res){
    		    _this.next().text('\u63d0\u4ea4\u5f02\u5e38');
    		}
    });
    
    return false;
  });
});
</script>
{:hook('global_register_bottom_extra')}
</body>
</html>